package cfca.paperless.client.servlet._2_extend._2_09_SendShortMessage;

import java.util.Date;

import cfca.paperless.client.servlet.PaperlessClient;
import cfca.paperless.client.servlet.PaperlessCloudConfig;
import cfca.paperless.client.util.StringUtil;

public class SendShortMessageTest01 {

    /**
     * @param args
     */
    public static void main(String[] args) {
        try {
            long timeStart = System.currentTimeMillis();// 开始时间

            PaperlessClient clientBean = new PaperlessClient(PaperlessCloudConfig.extUrl, 10000, 60000);// 无纸化辅助接口的访问URL

            // 操作员编码或者机构号
            String operatorCode = PaperlessCloudConfig.operatorCode;
            // 渠道编码，可以为空
            String channelCode = PaperlessCloudConfig.channelCode;
            
            String sendMessageXml = "<Request>" +
                                    "<PhoneNo>15811274851</PhoneNo>" +
                                    "<SealCode>2143832563</SealCode>" +
                                    "<UserName></UserName>" +
                                    "<IdentificationType></IdentificationType>" +
                                    "<IdentificationNo></IdentificationNo>" +
                                    "<SealFlag>0</SealFlag>" +
                                    "<ValidityPeriod>100</ValidityPeriod>" +
                                    "<TemplateCode>haier_rzzl_dx01</TemplateCode>" +//短信模板
                                    "</Request>";
            String returnMessage = clientBean.sendShortMessage(sendMessageXml, operatorCode, channelCode);
            String code = StringUtil.getNodeText(returnMessage, "Code");
            if ("200".equals(code)) {
                System.out.println("OK:testSendShortMessage");
                System.out.println(returnMessage);
                long timeEnd = System.currentTimeMillis();// 结束时间
                System.out.println("time:" + (timeEnd - timeStart));
            } else {
                System.out.println(returnMessage);
            }

        } catch (Exception e) {
            e.printStackTrace();
        }

    }

}
